
import { CrowdTag, LaunchRankItem, PremisesCaseItem, PremisesInfoModel, RecapInfo } from '@/views/onePage/onePage.module';
import { $http } from './index';

export interface CaseListReq{
    projectId: string;
    pageNum: number;
    pageSize:number;
    tradeCode: string;// 行业编码
}

export interface CasesListRes{
    pageEntity: {
        data: PremisesCaseItem[];
        totalSize: number;
    }
}

// 查询楼盘基本信息
export function getPremiseInfo(premiseId: string): Promise<PremisesInfoModel> {
    return $http.get(`/premise/basicInfo/${premiseId}`);
}

// 查询楼盘的单元信息
export function getUnitRecapInfo(premiseId: string): Promise<RecapInfo[]> {
    return $http.get(`/premise/getUnitRecapInfo/${premiseId}`);
}

// 查询楼盘投放案例
export function getCasesList(params: CaseListReq): Promise<CasesListRes> {
    return $http.post('/premise/getCases', params);
}

// 查询楼盘TOP投放行业
export function getTopTrade(premiseId: string): Promise<{
    name: string;
    launchRankList: LaunchRankItem[]
}> {
    return $http.get(`/premise/topTrade/${premiseId}`);
}

// 查询楼盘人群标签数据
export function getCrowdTagData(premiseId: string): Promise<CrowdTag> {
    return $http.get(`/premise/crowdTagData/${premiseId}`);
}
